package com.catl.plc.master;

import com.catl.plc.handler.ModbusEntity;
import com.catl.plc.meta.RegisterTypeEnums;

import java.util.List;

/**
 * @Description TODO
 * @ClassName IMaster
 * @Date 2022/4/12 9:18
 * @Author 王东平
 */
public interface PlcOperation {
    boolean writeRegisters(RegisterTypeEnums registerType, int slaveId, int startOffset, List<Integer> commands);
    boolean writeRegister(RegisterTypeEnums registerType, int slaveId, int startOffset, Integer command);
    boolean writeRegisters(RegisterTypeEnums registerType, int startOffset, List<Integer> commands);
    boolean writeRegister(RegisterTypeEnums registerType, int startOffset, Integer command);
    boolean writeEntity(int slaveId, ModbusEntity entity);
    boolean writeEntity(ModbusEntity entity);
    boolean writeEntities(int slaveId, List<? extends ModbusEntity> entities);
    boolean writeEntities(List<? extends ModbusEntity> entities);

    List<Integer> readRegister(RegisterTypeEnums registerType, int slaveId, int startOffset, int length);
    List<Integer> readRegister(RegisterTypeEnums registerType, int startOffset, int length);
    List<Integer> readByEntity(int slaveId, Class<? extends ModbusEntity> clazz);
    List<Integer> readByEntity(Class<? extends ModbusEntity> clazz);
    List<Integer> getShortData(int slaveId, Class<? extends ModbusEntity> clazz);
    List<Integer> getShortData(Class<? extends ModbusEntity> clazz);
    List<char[]> getCharData(int slaveId, Class<? extends ModbusEntity> clazz);
    List<char[]> getCharData(Class<? extends ModbusEntity> clazz);
    ModbusEntity readEntity(int slaveId, Class<? extends ModbusEntity> clazz);
    ModbusEntity readEntity(Class<? extends ModbusEntity> clazz);
    List<? extends ModbusEntity> readEntities(int slaveId, Class<? extends ModbusEntity> clazz);
    List<? extends ModbusEntity> readEntities(Class<? extends ModbusEntity> clazz);

}
